package com.leesche.netdoll.communication.protocol;

public enum FrameType {

	START(0x00, "00", "启动帧"), //
	ACCEPT(0x02, "02", "确认应答帧"), //
	REFUSE(0x03, "03", "否认应答帧"), //
	UNKNOWN(0xFF, "FF", "未知");

	private int code;
	private String name;
	private String desc;

	private FrameType(int code, String name, String desc) {
		this.code = code;
		this.name = name;
		this.desc = desc;
	}

	public static FrameType fromCode(int code) {

		for (FrameType type : FrameType.values()) {
			if (type.getCode() == code) {
				return type;
			}
		}
		return UNKNOWN;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

}
